#ifndef ASTAR_HEURISTICS
#define ASTAR_HEURISTICS

#include <cmath>

//calculates the 2D manhattan distance
template<typename T>
T getManhattanDistance(T fromX, T fromY, T toX, T toY)
{
	return (std::abs(fromX-toX) + std::abs(fromY-toY)); 
}


//calculates the 3D manhattan distance
template<typename T>
T getManhattanDistance(T fromX, T fromY, T fromZ, T toX, T toY, T toZ)
{
	return (std::abs(fromX-toX) + std::abs(fromY-toY) + std::abs(fromZ-toZ)); 
}


//calculates the 2D euclidean distance
template<typename T>
T getEuclideanDistance(T fromX, T fromY, T toX, T toY)
{
	return (T) sqrt((fromX-toX)*(fromX-toX) + (fromY-toY)*(fromY-toY));
}

//calculates the 3D euclidean distance
template<typename T>
T getEuclideanDistance(T fromX, T fromY, T fromZ, T toX, T toY, T toZ)
{
	return (T) sqrt((fromX-toX)*(fromX-toX) + (fromY-toY)*(fromY-toY) + (fromZ-toZ)*(fromZ-toZ));
}


//calculates the 2D diagonal distance, using a cost of 1 for straight and diagonal movements
template<typename T>
T simpleDiagonalDistance(T fromX, T fromY, T toX, T toY) 
{ 
	return std::max(std::abs(fromX-toX), std::abs(fromY-toY)); 
}

#endif // ASTAR_HEURISTICS